using UnityEngine;

namespace LS.SimpleInput
{
    public struct Gesture
    {
        /// <summary>
        /// 输入id，
        /// </summary>
        public int inputId;
        public int deviceId;
        public InputPhase phase;
        public GestureType gestureType;
        public EventType eventType;
        public MoveDirection moveDirection;
        public float startTime;
        public float deltaTime;
        public float lastTime;
        public float duration;

        public float longTapStartTime;
        public float longTapDuration;

        public bool eventSystemDetected;
        public bool isTriggerThisFrame;

        public Vector2 startPoint;
        public Vector2 point;
        public Vector2 deltaPoint;

        public void Copy(Gesture gesture)
        {
            this.inputId = gesture.inputId;
            this.deviceId = gesture.deviceId;
            this.phase = gesture.phase;
            this.gestureType = gesture.gestureType;
            this.eventType = gesture.eventType;
            this.moveDirection = gesture.moveDirection;
            this.startTime = gesture.startTime;
            this.deltaTime = gesture.deltaTime;
            this.lastTime = gesture.lastTime;
            this.duration = gesture.duration;
            this.longTapStartTime = gesture.longTapStartTime;
            this.longTapDuration = gesture.longTapDuration;
            this.eventSystemDetected = gesture.eventSystemDetected;
            this.isTriggerThisFrame = gesture.isTriggerThisFrame;
            this.startPoint = gesture.startPoint;
            this.point = gesture.point;
            this.deltaPoint = gesture.deltaPoint;
        }

        public static Gesture Clone(Gesture gesture)
        {
            Gesture newGesture = new Gesture();
            newGesture.Copy(gesture);
            return newGesture;
        }
    }
}
